package com.china08.yxyapi.api.manage.tec.teaching.zujuan.intellcomponent;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.model.YxyApiPageReqModel;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.service.manage.tec.teaching.zujuan.IntellComponentKnowledgeQuestionService;

/**
 * 教育局平台办公 智能组卷 按章节
 * 
 */
//@Api(tags = { "v51", "智能组卷    按知识点" })
@CrossOrigin
@RestController
public class IntellComponentKnowledgeQuestionCountController {
	@Autowired
	private IntellComponentKnowledgeQuestionService intellComponentKnowledgeQuestionService;
//	@ApiOperation(value = "智能组卷    按知识点")
//	@ResponseBody
	@RequestMapping(value = "/api_yw/manage/tec/teaching/zujuan/intellknowledgecomponent/questioncount", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public RespModel precess(HttpServletRequest request, HttpServletResponse response, @RequestBody ReqModel reqModel) {
		RespModel model=new RespModel();
		// 所选的知识点id
		List<Integer> bookContentIdList = reqModel.bookContentIdList;
		// 题的难易程度
		String difficultyLevel1 = reqModel.difficultyLevel;
		List<Long> allCount=intellComponentKnowledgeQuestionService.getQuestionTypeAllCount(bookContentIdList, difficultyLevel1);
		
		
		model.singleCount=allCount.get(0);
		model.moreCount=allCount.get(1);
		model.blanksCount=allCount.get(2);
		model.answerCount=allCount.get(3);
		return model;
	}

	protected static class RespModel extends YxyApiRespModel {
		//单选题的数量
        public Long singleCount;
        //多选题的数量
        public Long moreCount;
        //填空题的数量
        public Long blanksCount;
        //解答题的数量
        public Long answerCount;
	}

	protected static class ReqModel extends YxyApiPageReqModel {
		// 知识点id
		public List<Integer> bookContentIdList;
		// 题的难易程度
		public String difficultyLevel;
	}
}
